package com.wing.wecom.controller;

import chat.qiye.wechat.sdk.api.contact.ContactUserApi;
import chat.qiye.wechat.sdk.api.contact.param.ContactUserParam;
import chat.qiye.wechat.sdk.api.contact.resp.ContactUserGetResp;
import chat.qiye.wechat.sdk.common.RespStatus;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 通讯录人员
 * @author : Hui.Wang [huzi.wh@gmail.com]
 * @version : 1.0
 * @date : 2021/9/14
 */
@RestController
public class ContactUserController {

    @Resource
    ContactUserApi contactUserApi;

    /**
     * 创建成员
     * @param contactUserParam
     * @return
     */
    @GetMapping("/contactUser/create")
    public RespStatus create(ContactUserParam contactUserParam) {
        return contactUserApi.create(contactUserParam);
    }

    /**
     * 读取成员
     * @return
     */
    @GetMapping("/contactUser/get")
    public ContactUserGetResp get(@RequestParam(value = "userid") String userid) {
        return contactUserApi.get(userid);
    }

    /**
     * 更新成员
     * @param contactUserParam
     * @return
     */
    @GetMapping("/contactUser/update")
    public RespStatus update(ContactUserParam contactUserParam) {
        return contactUserApi.update(contactUserParam);
    }

    /**
     * 删除成员
     * @param userid
     * @return
     */
    @GetMapping("/contactUser/delete")
    public RespStatus delete(String userid) {
        return contactUserApi.delete(userid);
    }

}
